#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<deque>
using namespace std;
const long long inf = 1e18;
int n;
long long d, k;
long long pos[500001], val[500001];
long long dp[500001];
deque<long long> Q;
bool check(long long mid) {
    if (!Q.empty())Q.clear();
    long long l = (d - mid < 0 ? 0 : d - mid);
    long long r = d + mid;
    int las = 0;
    for (int i = 0;i <= n;i++)
        dp[i] = -inf;
    dp[0] = 0;
    for (int i = 1;i <= n;i++)
    {
        while (pos[las] < pos[i] - r)las++;
        while (pos[i] - l >= pos[las] && pos[i] - r <= pos[las] && las < i)
        {
            while (Q.size() && (dp[Q.back()] <= dp[las] || pos[Q.back()] < pos[i] - r))
                Q.pop_back();
            Q.push_back(las);
            las++;
        }
        while (Q.size() && (pos[Q.front()]) < pos[i] - r)
            Q.pop_front();
        if (Q.size() != 0)dp[i] = dp[Q.front()] + val[i];
        if (dp[i] >= k)return 1;
    }
    return 0;
}
int main() {
    scanf("%d%lld%lld", &n, &d, &k);
    for (int i = 1;i <= n;i++)
        scanf("%lld%lld", &pos[i], &val[i]);
    long long l = 0, r = pos[n];
    while (l != r) {
        long long mid = (l + r) / 2;
        if (check(mid))r = mid;
        else l = mid + 1;
    }
    if (!check(l)) {
        printf("-1");
        return 0;
    }
    else printf("%lld", l);
    return 0;
}